<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/react.development.js"></script>
    <script src="../js/react-dom.development.js"></script>
    <script src="../js/babel.min.js"></script>
    <script src="../js/prop-types.js"></script>
</head>

<body>
    <div id="root"></div>
    <script type="text/babel">
        // 子组件
        function Child(props) {
            // return <h1>Child Component. In Children Component value = '{props.value}'</h1>
            console.log(props);
            return (
                <h1>
                    Child Component. time: {props.time}. value: {props.value}
                </h1>
            )
        }

        // 父组件Parent，并在父组件中嵌入子组件<Child/>
        function Parent(props) {
            console.log(props);
            return (
                <div>
                    <h1>Parent Component. Time: {props.time}</h1>
                    <Child
                        time={props.time + 'from parent'}
                        value={props.value + 'from parent'}
                    />
                </div>
            )
        }

        const value = 'I come from Parent Component'
        ReactDOM.render(<Parent time={Date()} value={value} />,
            document.getElementById('root'))
    </script>
</body>

</html>